package puzzle.projecteuler.p200;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;

public class Problem102C {

	/**
	 * @param args
	 */
	public static void main(String[] args) throws IOException {
		
		Point[][] ds = readData();
		Point p0 = new Point(0,0);
		int c = 0;
		for (int i = 0; i < ds.length; i ++) {
			if (check(ds[i][0],ds[i][1],ds[i][2],p0)) {
				c ++;
			}
		}
		System.out.println(c);
	}
	
	public static class Point {
		int x;
		int y;
		public Point(int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

	public static boolean check(Point p1, Point p2, Point p3, Point p0) {
		return (doubleArea(p0,p1,p2) + doubleArea(p0,p2,p3) + + doubleArea(p0,p3,p1) ==  doubleArea(p1,p2,p3)); 
	}
	
	public static int doubleArea(Point p1, Point p2, Point p3) {
		return Math.abs(p1.x*p3.y+p1.y*p2.x+p2.y*p3.x-p3.x*p1.y-p2.x*p3.y-p1.x*p2.y);
	}
	
	public static Point[][] readData() throws IOException {

		URL url = Problem102C.class.getResource("Problem102.txt");
		File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));

		Point[][] datas = new Point[1000][];
		BufferedReader br = new BufferedReader(new FileReader(file));
		String line = null;
		int r = 0;
		while ((line = br.readLine()) != null) {
			String[] tmp = line.split(",");
			datas[r] = new Point[3];
			for (int c = 0; c < datas[r].length; c ++) {
				datas[r][c] = new Point(Integer.valueOf(tmp[2*c]), Integer.valueOf(tmp[2*c+1]));
			}
			r ++;
		}
		br.close();
		return datas;
	}
}
